<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML>
<html>
  <head>
    
    <title>商品进货管理</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    	
	
	<link href="<%=basePath %>/background/css/layout.css" rel="stylesheet" type="text/css" />
    <link href="<%=basePath %>/background/css/header.css" rel="stylesheet" type="text/css" />
    <link href="<%=basePath %>/warehouse/css/button.css" rel="stylesheet" type="text/css" />
    
<style type="text/css">  
  


  
</style> 
  </head>
  
  <body>
  <div id="container">
  <div id="header">
		 <jsp:include page="/background/head.jsp"></jsp:include>
	</div>
  <div id="applicationbar">
		 <jsp:include page="/background/app/appbar.jsp"></jsp:include>
	</div>
  <div id="mainContent">
    <div id="sidebar">

		<jsp:include page="/background/left.jsp"></jsp:include>
	</div>
	
	
	
    <div id="content" >
    
	
	
	
	 <div style="border:1px solid #ffffff; border-top-color:#6cb1f1; background-color: #e5f3ff; width: 100%; top: 0px;" >
							查找进货信息
     			
     			<input type="button" value="查看谁有权限"  class="small button orange"
     				onclick="javascript:openUrlForDialog('selectoperatorlimitedAction_background.action?limitedCode=<s:property value="limitedcode"/>')"/>
     				
     				<a href="managepurchaselist_warehouse.action?flowCode=FLOW.WAREHOUSE.PURCHASELIST.START">已打完进仓单:<s:property value="flowWarehouseStartNum"/></a>
     				
     				<a href="managepurchaselist_warehouse.action?flowCode=FLOW.WAREHOUSE.PURCHASELIST.CONFIRM">确认进仓:<s:property value="flowWarehouseConfirmNum"/></a>
     				
     				<a href="managepurchaselist_warehouse.action?flowCode=FLOW.WAREHOUSE.PURCHASELIST.CANCEL">取消流程:<s:property value="flowWarehouseCancelNum"/></a>
     				
     				<a href="managepurchaselist_warehouse.action?flowCode=FLOW.WAREHOUSE.PURCHASELIST.ORDER">应付账款:<s:property value="flowWarehouseOrderNum"/>单,<s:property value="flowWarehouseOrderPrice"/>元</a>
     				<a href="managepurchaselist_warehouse.action?flowCode=FLOW.WAREHOUSE.PURCHASELIST.PAY">现金结款:<s:property value="flowWarehousePayNum"/></a>
     				
		<div style="float: right;">
			<a href="preaddpurchaselist_warehouse.action">进货</a>
     		</div>
		</div>
		
		 <div style=" height: 25px;margin: 15px;">
		
		<s:fielderror id="errormessage" />
		
	    	<form id="managepurchase_warehouse" name="managepurchase_warehouse" onSubmit="return true;" action="managepurchaselist_warehouse.action" method="POST" >
    	
			
					  查找进货信息:<input type="text" name="searchStr" class="searchtxt" size="30" value="<s:property value="searchStr"/>" autofocus="autofocus"/>
					  <input type="submit" style="bottom: 3px" class="large button blue" value="查找" />
				  
	</form> 
		</div>
	
		<div style="width: 100%;padding:0px;float:left;">
			<div style="border:1px solid #ffffff; border-top-color:#6cb1f1; background-color: #e5f3ff;width:100%; top: 0px;">
				进货单列表  <a href="#">今天进仓单数:<s:property value="dayCount"/> 进货总额:<s:property value="dayTotal"/></a>
     			
     			<a href="<%=basePath %>/warehouse/managepurchase_warehouse.action">查看进货商品信息 </a>
			</div>
			
			<div>
				<table ><tbody>
					<tr>
						
							<td style="border-bottom:#e5f3ff solid 1px;" width="515" align="center">产品</td>
							
							<td style="border-bottom:#e5f3ff solid 1px;" width="105" align="center">总价(元)</td>
							<td style="border-bottom:#e5f3ff solid 1px;" width="205" align="center">供应商名称</td>
							
					
							<td style="border-bottom:#e5f3ff solid 1px;" width="115" align="center">操作人</td>
		
						</tr>
						</tbody>
				</table>
			</div>
			<div>
			
		<table style="width: 100%">
			<s:iterator id="purchaselistList" value="purchaselistList">
				<tr>
					
						
						<td>
							<table  style= "border:1px solid #ffffff; border-bottom-color:#b2d5ff;
    border-left-color:#b2d5ff;border-right-color:#b2d5ff;border-top-color:#b2d5ff;width: 100%;">
    
				
									<tr>
										<td>
										
										<s:if test="#purchaselistList.iscancel_purchaselist == true">
														
														
											<table bgcolor="#f3f7fc" width="100%">
												<tr>
													<td width="125">
														<s>
															进仓单号:
														</s><a href="purchaselistinfo_warehouse.action?id=<s:property value="#purchaselistList.id_purchaselist"/>" title=""><s:property value="#purchaselistList.id_purchaselist"/></a>
													<td>
														
													</td>
													<td align="right">
														进仓时间:<s:property value="#purchaselistList.date_purchaselist"/>
													</td>
													
												 	
												</tr>
											</table>
											
										</s:if>
										
										<s:elseif test="#purchaselistList.iscancel_purchaselist == false">
														
														
											<table  bgcolor="#f3f7fc" width="100%">
												<tr>
													<td width="225">
														
															进仓单号:
														<a href="purchaselistinfo_warehouse.action?id=<s:property value="#purchaselistList.id_purchaselist"/>" title=""><s:property value="#purchaselistList.id_purchaselist"/></a>
														<s:if test="#purchaselistList.isconfirm_purchaselist == false">
														未确认进仓
														</s:if>
													<td>
														
													</td>
													<td align="right">
														进仓时间:<s:property value="#purchaselistList.date_purchaselist"/>
													</td>
													
												 	
												</tr>
											</table>
											
										</s:elseif>
										
										
										</td>
									</tr>
									<tr>
										<td>
											<table width="100%" border="1" cellpadding="0"  cellspacing="0" bordercolor="#f5f5f5" style="border-collapse:collapse; border-width:1px 0 0 1px;">
												<tr>
													<td width="515" >
													
													
													
													
													<s:iterator id="purchaseList" value="purchaseListMap.get(#purchaselistList.id_purchaselist)">
														<table width="100%">
															<tr>
																<td width="105">
																 	
																
																</td>
																<td width="305">
																<a href="#">
																<s:property value="#purchaseList.goodsname_purchase"/>
																</a>
																</td>
																
																<td width="105" align="center">
																
																<s:property value="#purchaseList.price_purchase"/></br>
																
																<s:if test="#purchaseList.number_purchase > 1">
																<font color="red">
																
																(<s:property value="#purchaseList.number_purchase"/>件)
																</font>
																</s:if>
																<s:else>
																
																(<s:property value="#purchaseList.number_purchase"/>件)
																
																</s:else>
																</td>
															</tr>
															
														</table>
													</s:iterator>
													
														
													</td>
													
													<td align="center" width="85">
														<s:property value="#purchaselistList.total_purchaselist"/></br>
														<font color="#cococo">(快递:<s:property value="#purchaselistList.shipprice_purchaselist"/>)</font>
													</td>
													
													<td align="center" width="205" title="<s:property value="#purchaselistList.supplierinfo_purchaselist"/>"> 
														<s:property value="#purchaselistList.supplier_purchaselist"/>
													</td>
													
													<td align="center" width="85" title="<s:property value="flowRecordlistMap.get(#receiptlistList.id_receiptlist).username_recordlist"/>"> 
														<s:property value="flowRecordlistMap.get(#purchaselistList.id_purchaselist).cnname_recordlist"/>
														</br>
															<button class="large button orange" onclick="openUrlForDialog('<%=basePath %>/flow/managepurchaselistflow.action?kind=FLOW.WAREHOUSE.PURCHASELIST&kindid=<s:property value="#purchaselistList.id_purchaselist"/>')">
															  查看流程
														</button>
													</td>
													
												 	
													
													<td align="center" width="85">
													
														<p>
														<s:property value="#purchaselistList.username_purchaselist"/>
														 
														</p>
														<s:if test="#session.operatorInfo.email_operator == #purchaselistList.useremail_purchaselist">
															<s:if test="#purchaselistList.iscancel_purchaselist == false">
															<a href="javascript:del('<s:property value="#purchaselistList.supplier_purchaselist"/>',<s:property value="#purchaselistList.id_purchaselist"/>)"> 取消此进仓单 </a>
															</s:if>
														</s:if>
													
													</td>
												</tr>
											</table>
										</td>
									</tr>
									<s:if test="#purchaselistList.remark_purchaselist!=''">
									<tr>
										<td bgcolor="fff7d9" >
										<table width="100%">
											<tr>
											<td bgcolor="fff7d9">
											备注：<s:property value="#purchaselistList.remark_purchaselist"/>
											
										</td>
										<td align="right"><a href="#"/>修改</a>	</td>
										</tr>
										</table>
										
										</td>
									</tr>
									</s:if>
									
									
							</table>
						
						
						</td>
						
					
						
						
							
					
				</tr>
			</s:iterator>
		</table>
			</div>
			
			
			
		</div>
		<div >
		
			
						<%
						
						
						
						String url = "managepurchaselist_warehouse.action";//*/
						int pageSize = (Integer) request.getAttribute("pageSize");
						int beginPageNum =  (Integer) request.getAttribute("beginPageNum");
						int countRow =  (Integer) request.getAttribute("rowNum");
					    int countPage =(countRow-1)/pageSize+1;
					    int currentPage = countPage - (countRow-beginPageNum)/pageSize;
					    
						String flowCode = (String)request.getAttribute("flowCode");//*/
					    
					 	 
					    
					    String searchstr = (String)request.getParameter("searchStr");//*/
					    if(searchstr != null){
					    	searchstr = java.net.URLDecoder.decode(searchstr, "UTF-8");
					    	searchstr = java.net.URLEncoder.encode(searchstr,"UTF-8");
					    	searchstr = searchstr.replaceAll("%", "%25");
					    }else{
					    	searchstr = "";
					    }
					    
					    if((beginPageNum-pageSize+1) >= 1){%>
				    	<a href="<%=url %>?searchStr=<%=searchstr %>&flowCode=<%=flowCode %>&beginPageNum=<%=(beginPageNum-pageSize) %>">
								上一页 </a>
				   <% }
					    
					    //beginPageNum =  (pageNum - 1) * pageSize;
						StringBuffer chagePageBuff = new StringBuffer();
						if(countPage >= 2){ 
							int begin = currentPage - 9;
							int end = currentPage + 9;
							
							if(begin < 1){
								begin = 0;
							}
							if(end > countPage){
								end = countPage-1;
							}
							
							
							for(int i=begin;i<countPage;i++){
								
								
								
								
								
								if(beginPageNum == i*pageSize){
									%>
									<%=i+1 %>
									<%
								}else{
									%>
									<a href="<%=url %>?searchStr=<%=searchstr %>&flowCode=<%=flowCode %>&beginPageNum=<%=i*pageSize %>">
									[<%=i+1 %>] </a>
									<%
								}
								
								if(i > end){
									
									break;
									
								}
							}
						}
						
						if((beginPageNum+pageSize-countRow) < 0){%>
				    	<a href="<%=url %>?searchStr=<%=searchstr %>&flowCode=<%=flowCode %>&beginPageNum=<%=(beginPageNum+pageSize) %>">
								下一页 </a>
				   		<% }
						if(countPage != 1){%>
			    		<input type="text" size="4" id="goPageNum" name="goPageNum"/> / <%=countPage %> <button onclick="gotoPage();">跳转</button>
				   		<% }
						//*/
						%>
					
		</div>
	
	</div>
	
	
  </div>
  
  <div id="footer">
<jsp:include page="/background/tail.jsp"></jsp:include>
	</div>
</div>
  
  
  
  

  </body>
<script type="text/javascript">

function del(name,id){
	if(confirm("删除 "+"进货单号:"+id+" \"" + name + "\" ")){
		window.location.href='cancelpurchaselist_warehouse.action?id=' + id;
	}
}

function gotoPage(){
	countPage = <%=countPage %>;
	pageSize = <%=pageSize %>;
	pageNum = document.getElementById("goPageNum").value;

	pageNum = parseInt(pageNum);
	if(pageNum > countPage){
		pageNum = countPage;
	}
	beginPageNum = pageNum * pageSize - pageSize;
	if(beginPageNum < 0){
		beginPageNum = 0;

	}
	if(isNaN(beginPageNum)){ 
		beginPageNum = 0;
	}
	url = '<%=url %>?searchStr=<%=searchstr %>&flowCode=<%=flowCode %>&beginPageNum=' + beginPageNum;
	//alert(url);
	window.location.href=url;
}

</script>
</html>
